package com.gaussian.property.app.vo.dashboard;

import cn.hutool.core.util.NumberUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @description: 扣款明细
 * @author: songqi(13776346982)
 * @date: 2024/10/4 21:32
 */
@Data
public class DeductionDetail {

    @ApiModelProperty("人员考勤扣款总计")
    private Double attendanceDeduction;

    @ApiModelProperty("人员考勤数据明细")
    private AttendanceIndicator attendanceDataDetail;

    @ApiModelProperty("人员考勤扣款明细")
    private AttendanceIndicator attendanceDeductionDetail;

    @ApiModelProperty("作业品质扣款总计")
    private Double qualityDeduction;

    @ApiModelProperty("作业品质数据明细")
    private QualityIndicator qualityDataDetail;

    @ApiModelProperty("作业品质扣款明细")
    private QualityIndicator qualityDeductionDetail;

    @ApiModelProperty("总计扣款")
    private Double totalDeduction;


    public Double getTotalDeduction() {
        if(attendanceDeduction != null && qualityDeduction != null){
            return NumberUtil.add(attendanceDeduction, qualityDeduction);
        }
        return 0.0d;
    }

    @Data
    public static class AttendanceIndicator {

        @ApiModelProperty("怠工")
        private BigDecimal slowDown;

        @ApiModelProperty("聚岗")
        private BigDecimal gatherPos;

        @ApiModelProperty("脱岗")
        private BigDecimal leavePos;

        @ApiModelProperty("串岗")
        private BigDecimal gadPos;

        @ApiModelProperty("离场")
        private BigDecimal leaveSite;

        @ApiModelProperty("缺岗")
        private BigDecimal vacantPos;

        @ApiModelProperty("超龄")
        private BigDecimal overage;
    }


    @Data
    public static class QualityIndicator{

        @ApiModelProperty("覆盖风险")
        private BigDecimal riskArea;

        @ApiModelProperty("巡检覆盖度")
        private BigDecimal inspectCoverRate;
    }

}
